
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	>
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>mymsgro</title>
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	<link rel="stylesheet" type="text/css" href="css/meniu.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />

</h:head>
<h:body>

	<ui:include src="header.xhtml" />

	<h:panelGroup layout="block" id="content">

		<ui:include src="leftMenu.xhtml" />

		<h:panelGroup layout="block" id="contenRight">

			<h:panelGroup layout="block" id="header" style="margin-top: 20px;">
				<ul>
					<li id="selected"><a>Search Results</a></li>
				</ul>
			</h:panelGroup>

			<h:panelGroup layout="block" id="contentTab">
				<h:form enctype="multipart/form-data">
					<h:commandButton style="width:50px; height:30px;"
						image="resources/img/back-button.png" action="searchUserResults.xhtml"
						immediate="true"></h:commandButton>
						<br />
					<p:dataTable id="searchUserTable"
						value="#{searchUserTableData.foundUserArr}" var="searchRes"
						paginator="true" rows="5"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="5,10,15">

						<p:column rendered="#{searchRes.photo != null}">
							<f:facet name="header">
								<h:outputText value="Photo" />
							</f:facet>
							<p:graphicImage value="/img/#{searchUserTableData.getTempPhotoById(searchRes.id)}" width="200" height ="200"/>
							
						</p:column>

						<p:column rendered="#{searchRes.photo == null}">
							<f:facet name="header">
								<h:outputText value="Photo" />
							</f:facet>
							<p:graphicImage rendered="#{searchRes.photo == null}"
								value="/resources/img/blankProfile.jpeg" width="200"
								height="200"></p:graphicImage>
						</p:column>

						<p:column>
							<f:facet name="header">
								<h:outputText value="Lastname" />
							</f:facet>
							<h:outputText value="#{searchRes.lastname}" />
						</p:column>

						<p:column>
							<f:facet name="header">
								<h:outputText value="Firstname" />
							</f:facet>
							<h:outputText value="#{searchRes.firstname}" />
						</p:column>

						<p:column>
							<f:facet name="header">
								<h:outputText value="Department " />
							</f:facet>
							<h:outputText value="#{searchRes.departmentName}">
							</h:outputText>
						</p:column>

						<p:column>
							<f:facet name="header">
								<h:outputText value="Show details" />
							</f:facet>
							<h:commandButton
								rendered="#{controllerBean.canCRUDOnEmployees() || controllerBean.canCRUDOnEmployeesByDepartment()}"
								id="userDetailsBtn" value="Details"
								action="#{employeeBean.updateUsers}" styleClass="butoaneDomain2">
								<f:param name="updateId" value="#{searchRes.id}" />
								<f:param name="updateType" value="#{searchRes.empDType}" />
							</h:commandButton>
						</p:column>


					</p:dataTable>

				</h:form>
			</h:panelGroup>
		</h:panelGroup>
	</h:panelGroup>
</h:body>
</html>